{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Getting Started\n",
    "Let's start a new session. **Replace client id and secret placeholders with actual values.**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "from gs_quant.session import Environment, GsSession\n",
    "import pprint as pp\n",
    "\n",
    "# session = AppSession('CLIENT_ID', 'CLIENT_SECRET', Environment.PROD)\n",
    "GsSession.use(Environment.QA)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Retrieve information about a dataset from the catalog."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<gs_quant.target.data.DataSetEntity object at 0x000000000F23BA20>\n"
     ]
    }
   ],
   "source": [
    "from gs_quant.data import Dataset\n",
    "from gs_quant.api.gs.data import GsDataApi\n",
    "dataset = Dataset('EDRVOL_PERCENT_SHORT')\n",
    "definition = GsDataApi.get_definition(dataset)\n",
    "pp.pprint(definition)  # show selected metadata"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Find out what assets are included in the dataset."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'assetId': 'MA4B66MW5E27U8NN8ST',\n",
      "  'bbid': 'DJX',\n",
      "  'description': '',\n",
      "  'name': 'Dow Jones Indu Avg'},\n",
      " {'assetId': 'MA2NWD8Y5ZC3T6A8',\n",
      "  'bbid': 'TPNBNK',\n",
      "  'description': '',\n",
      "  'name': 'TOPIX Banks Index'},\n",
      " {'assetId': 'MA4B66MW5E27U8P32DZ',\n",
      "  'bbid': 'MCXP',\n",
      "  'description': '',\n",
      "  'name': 'STXE Mid 200 EUR PR'}]\n"
     ]
    }
   ],
   "source": [
    "coverage = GsDataApi.get_coverage(dataset)\n",
    "pp.pprint(coverage[:3])  # show the first 3 covered assets"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Retrieving a Data Table\n",
    "Get data as a Pandas DataFrame. Note: this example will not work if you do not have access to EDRVOL_PERCENT_SHORT."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>absoluteStrike</th>\n",
       "      <th>assetId</th>\n",
       "      <th>date</th>\n",
       "      <th>impliedVolatility</th>\n",
       "      <th>relativeStrike</th>\n",
       "      <th>ric</th>\n",
       "      <th>strikeReference</th>\n",
       "      <th>tenor</th>\n",
       "      <th>updateTime</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2703.422973</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.124072</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>9m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2697.130446</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.091925</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>3m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2702.229408</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.121056</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>8m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2702.714955</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.117516</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>7m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2695.790000</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.118894</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>spot</td>\n",
       "      <td>7m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>absoluteStrike</th>\n",
       "      <th>assetId</th>\n",
       "      <th>date</th>\n",
       "      <th>impliedVolatility</th>\n",
       "      <th>relativeStrike</th>\n",
       "      <th>ric</th>\n",
       "      <th>strikeReference</th>\n",
       "      <th>tenor</th>\n",
       "      <th>updateTime</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2703.422973</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.124072</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>9m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2697.130446</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.091925</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>3m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2702.229408</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.121056</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>8m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2702.714955</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.117516</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>forward</td>\n",
       "      <td>7m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2695.790000</td>\n",
       "      <td>MA4B66MW5E27U8P32SB</td>\n",
       "      <td>2018-01-02</td>\n",
       "      <td>0.118894</td>\n",
       "      <td>1.0</td>\n",
       "      <td>.SPX</td>\n",
       "      <td>spot</td>\n",
       "      <td>7m</td>\n",
       "      <td>2019-01-14T13:10:23Z</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from datetime import date\n",
    "df = dataset.get_data(date(2018, 1, 2), date(2018, 1, 9), ric='.SPX', relativeStrike=1)\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Retrieving a Data Series\n",
    "Get S&P 500 prices as a Pandas Series. Note: this example will not work if you do not have access to TREOD."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAADyCAYAAABEWhLBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvqOYd8AAAIABJREFUeJztnXd4W9X5+D+v5G0nduzs6eyQSQYJo+wAScNoGWW0QFsoLWVTWmZLW1rKKPADSmkZaYEvDdAwywphhoSQBWST7STOdOI4HomXdH5/3Cv5SpZseUqy3s/z5Mm9554rnWNJ9z3nnWKMQVEURUk8XNEegKIoihIdVAAoiqIkKCoAFEVREhQVAIqiKAmKCgBFUZQERQWAoihKgqICQFEUJUFRAaAoipKgNCoARGSmiOwVkVVB7deJyDoRWS0iDzjabxeRjfa1Mxzt0+y2jSJyW+tOQ1EURWkq0lgksIicAJQDzxtjRtttJwN3AjOMMVUi0t0Ys1dERgKzgMlAb+BDYJj9UuuB04BCYAlwsTFmTRvMSVEURYmApMY6GGPmiUh+UPPVwH3GmCq7z167/RzgJbt9i4hsxBIGABuNMZsBROQ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ixbOpRrLrRVjTDkQ7VVZSz+XL+2+m7BWdFEjgrlcD+wUkRONMZ/Ztz2N9bCZCwwQkfHG8jgpa/8ZWLTSPCYaYwqBve0/gzpaOJePgP4icqQx5qUoDN9Pu9sARORErAdFFyzf3nuAGuBknzHHWAafPwAPGmOeAz4ALhORr7Gka1QfLj50LjqXtibCuRish9HvHbfOAH6J5TAxxn74R41WnEdhOw47JK0wl2+w5rKrHYcdmihsmY4HLnWc/x3Lu+fHwDK7zYWlU5uN5RuPfT4oWlslnYvOJQ7m8gqQb7edA5wQ7fF3tHl0tLlEwwtoGfCK1AU7LQD6G2P+jbWdus5Yq7O+QI2xjW7GmN3GmM1RGG9D6Fx0Lm1NU+biMcYUABhj3jTGzIvGgMPQUeYBHWgu7S4AjDGHjDFVpi7Y6TQsX2WAnwBHiMjbwCzgq/YeX1PQucQmiT6XWHGJdNJR5gEday5RywVkS0+DFXH5lt1cBtwBjAa2GMuPNubRucQmiToXY+sbYpGOMg/oGHOJZiCYF0gG9gFjbYn5W8BrjJkfLz9MG51LbKJziT06yjygI8wlmgYIrORaXqxcJVdEcyw6F51LrP/rKHPpKPPoCHOJaiSwiPQFLgUeNvGXzjkAnUtsonOJPTrKPCD+5xL1VBCKoihKdIipZHCKoihK+6ECQFEUJUFRAaAoipKgqABQFEVJUFQAKIqiJCgqABRFURIUFQCKoigJigoARVGUBOX/A2VogOwUsqyDAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from datetime import date\n",
    "dataset = Dataset('TREOD')\n",
    "series = dataset.get_data_series('tradePrice', date(2006, 1, 1), date(2012, 1, 1), assetId='MA4B66MW5E27U8P32SB')\n",
    "plt.clf()\n",
    "series.plot()\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Calculate max drawdown and plot it."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAADyCAYAAAClHcXVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvqOYd8AAAGNBJREFUeJzt3XuUnHWd5/H3p6r6knTSuUDnAiThYiDI5QRpUZYFdCErLDOEcZTFcSS6crLecZzdFddZddU5ZsYRZ5lx3BNwxiycHYKsmngZNcTbqAMSFHGAxYAyAolJQOOCyq37u388T5umU33LU11PVf0+r3P61FNVT9Xz+3ZVfepXv+emiMDMzNJSKbsBZmbWfA5/M7MEOfzNzBLk8DczS5DD38wsQQ5/M7MENST8JV0g6T5J90u6qs79PZI25/ffJunoRizXzMwOTeHwl1QFPgZcCDwfeJWk54+Z7fXALyLiecBHgT8rulwzMzt0jej5nwHcHxE/joingRuBtWPmWQtsyqdvBs6TpAYs28zMDkEjwv9I4KFR1x/Ob6s7T0Q8C/wSOKwByzYzs0NQa8Bz1OvBjz1mxFTmQdJ6YD1AX1/f6atWrZp2YyJg7+NPsvfxpwCo+AeGmbWZ4QhOPmIehxJfd9xxx6MRMTDZfI0I/4eBZaOuHwXsGmeehyXVgHnAz8c+UURsBDYCDA4Oxo4dOw65US/58Nd48LFfH/LjzczKUpX49vtfRm9XddqPlfQvU5mvEcM+twMrJR0jqRu4DNg6Zp6twLp8+hXAV2OGjyj3xpccN5NPb2bW1gqHfz6G/xbgy8C9wE0Rcbek90u6OJ/tE8Bhku4H3gEctDloo61dna12qHjUx8zsII0Y9iEivgh8ccxt7xk1/STwykYsa6pGfi4N+4jVZmYH6eg9fE9cOrfummYzs9R1dPjP6qoevEmRmZl1ePh3T39NuZlZCjo6/C8/82h6ahWv9DUzG6Ojw/9lJy3hvg9eyGfffFbZTTE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ZL5OVxLa3ItradT6oD2r6XUwzuYmVk5WubAbmZm1jwOfzOzBDn8zcwS5PA3M0uQw9/MLEEOfzOzBDn8zcwS9P8BS8OKcsJb1mgAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import gs_quant.timeseries as ts  # timeseries functions do not require an open session\n",
    "mdd = ts.max_drawdown(series)\n",
    "plt.clf()\n",
    "mdd.plot('area')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Identifier Mapping\n",
    "Map identifiers from one type to another e.g. Marquee asset ID to BBID."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "map_identifiers() missing 1 required positional argument: 'ids'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-7-fba2688c9540>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mgs_quant\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0massets\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mAsset\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mids\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mAsset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmap_identifiers\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'id'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'bbid'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'MA4B66MW5E27U8P32SB'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'MA4B66MW5E27U8NN95P'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'MA4B66MW5E27UAHKG34'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      3\u001b[0m \u001b[0mpp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mids\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mTypeError\u001b[0m: map_identifiers() missing 1 required positional argument: 'ids'"
     ]
    }
   ],
   "source": [
    "from gs_quant.api.gs.assets import GsAssetApi\n",
    "ids = GsAssetApi.map_identifiers('id', 'bbid', ['MA4B66MW5E27U8P32SB', 'MA4B66MW5E27U8NN95P', 'MA4B66MW5E27UAHKG34'])\n",
    "pp.pprint(ids)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Cleaning Up"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "When finished, call session.finish() to free up resources. Alternatively, use 'with' syntax to take care of this automatically."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset = Dataset('TREOD')\n",
    "\n",
    "with GsSession.get(Environment.PROD):\n",
    "    # session is open in this block\n",
    "    series = dataset.get_data_series('tradePrice', date(2006, 1, 1), date(2012, 1, 1), assetId='MA4B66MW5E27U8P32SB')\n",
    "\n",
    "# session is closed out here\n",
    "mdd = ts.max_drawdown(series)\n",
    "mdd.head()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
